[DllImport("coredll.dll")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
Declare Function SendMessage Lib "coredll.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
If you are searching for a way to send keys to an application, you can use System.Windows.Forms.SendKeys.Send(keys) after bringing the window to the top via the SetForegroundWindow API.
[DllImport("coredll.dll")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
public const int WM_CLOSE = 16;
private void button1_Click(object sender, System.EventArgs e)
{
SendMessage(this.Handle, WM_CLOSE, 0, 0);
}
Do you know one? Please contribute it!